﻿using System;
using System.Collections.Generic;
using System.Xml;
using System.Text;
using SdmxMl.Common;

namespace SdmxMl.Structure
{
    /// <summary>
    /// PrimaryMeasureType describes the observation values for all presentations of the data, 
    /// except those cross-sectional formats which have multiple measures (for which a set of 
    /// cross-sectional measures are used instead). The concept attribute points to the unique 
    /// concept represented by the measure. The PrimaryMeasure  is conventionally associated 
    /// with the OBS-VALUE concept. The TextFormat element allows description of the contents 
    /// of the observation value. The codelist attribute references a codelist if the observation 
    /// value is coded. If this attribute is used, then codelistAgencyID must contain the ID of 
    /// the maintenance agency of the referenced codelist. The codelistVersion attribute may be 
    /// specified - if not, then the version of the referenced codelist is assumed to be "1.0".
    /// </summary>
    public class PrimaryMeasureType : BaseDimensionType
    {
        public PrimaryMeasureType()
            : base()
        {
        }


        public PrimaryMeasureType(XmlNode nodeArtefact, SdmxNamespaceManager nsmgr)
            : base(nodeArtefact, nsmgr)
        {
        }

        public void WriteXml(XmlTextWriter xw, string prefix, string tag)
        {
            xw.WriteStartElement(prefix, tag, null);

            WriteReferences(xw, prefix);

            // Text Format
            textFormat.WriteXml(xw, prefix, "TextFormat");

            // Annotations
            AnnotationList.WriteXml(xw, prefix, null);

            xw.WriteEndElement();
        }

    }


}
